body {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background: #000;
}
div {
  width: 400px;
  height: 400px;
  position: relative;
  overflow: hidden;
  padding: 15px;
}
div::after {
  content: '';
  position: absolute;
  display: block;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  z-index: -1;
  transform: scale(3);
  background: linear-gradient(to right, #f1c40f, white, #e67e22, #e74c3c, #9b59b6);
  transition: 2s;
}
div aside {
  height: 100%;
  overflow: hidden;
}
div:hover::after {
  transform: scale(3) rotate(260deg);
}
